package server.business.task.config;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.poi.ss.usermodel.Workbook;

import server.ServerConfigCache;
import server.utils.AppFile;

import com.core.config.GameModel;
import com.core.config.ILoader;
import com.core.utils.ExcelUtils;

/**
 * 任务配置加载
 * @author King
 *
 */
public class TaskConfigLoader implements ILoader
{
	private static final String excelName = "task.xls";
	
	
	@Override
	public void load()
	{
		Workbook wb = ExcelUtils.loadExcel(AppFile.getExcelConfig(excelName));
		List<TaskConfig> list = new ArrayList<TaskConfig>();
		GameModel.initModels(wb.getSheetAt(0), TaskConfig.class, list);
		ServerConfigCache.taskMap = new ConcurrentHashMap<Integer, TaskConfig>();
		GameModel.listToMap(list, ServerConfigCache.taskMap, "taskId");
	}
}
